package gxb.test07;

public class Kennel{
    public static void main(String[] args) {
        // 111
        Dog dog1 = new Dog("Charlie", 2);
        Dog dog2 = new Dog("Bella", 4);
        Dog dog3 = new Dog("Max", 6);

        // 更新狗1的年龄
        dog1.setAge(3);

        // 输出狗的信息
        System.out.println(dog1.toString());
        System.out.println(dog2.toString());
        System.out.println(dog3.toString());
    }

}
class Dog {
    int age;
    String name;

    public Dog(String name,int age) {
        this.age = age;
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public int calculateHumanAge() {
        return age * 7;
    }

    @Override
    public String toString() {
        return "Dog{" +
                "age=" + age +
                ", name='" + name + '\'' +
                '}';
    }
}

